home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / Pascal Strings / MessageString.h < prev    next >
Text File  |  2000-06-23  |  1KB  |  71 lines

  1. // MessageString.h
  2.  
  3. #ifndef MessageString_h
  4. #define MessageString_h
  5.  
  6. #ifndef Str_h
  7. #include "Str.h"
  8. #endif
  9. #ifndef ResourceID_h
  10. #include "ResourceID.h"
  11. #endif
  12.  
  13. class MessageString: public String255
  14.   {
  15.     public:
  16.         class Substitution;
  17.         
  18.         MessageString( ResourceID, uint16 itemNumber );
  19.     
  20.         inline Substitution Substitute( uint8, ConstData );
  21.   };
  22.  
  23. class MessageString::Substitution
  24.   {
  25.     friend Substitution MessageString::Substitute( uint8, ConstData );
  26.     
  27.     private:
  28.         MessageString *target;
  29.         Substitution *next;
  30.         ConstData replacement;
  31.         uint8 toReplace;
  32.     
  33.         // not implemented:
  34.             void operator=( const Substitution& );
  35.  
  36.         Substitution( MessageString& theTarget,
  37.                           uint8 source,
  38.                           ConstData theReplacement )
  39.           : target( &theTarget ),
  40.              toReplace( source ),
  41.              replacement( theReplacement ),
  42.              next( 0 )
  43.           {}
  44.  
  45.         Substitution( Substitution& theNext,
  46.                           uint8 source,
  47.                           ConstData theReplacement )
  48.           : target( theNext.target ),
  49.              toReplace( source ),
  50.              replacement( theReplacement ),
  51.              next( &theNext )
  52.           {}
  53.         
  54.         void Substitute();
  55.         
  56.     public:
  57.         ~Substitution();                
  58.         
  59.         Substitution Substitute( uint8 s, ConstData r )
  60.           {
  61.             return Substitution( *this, s, r );
  62.           }
  63.   };
  64.  
  65. inline MessageString::Substitution MessageString::Substitute( uint8 s, ConstData r )
  66.   {
  67.     return Substitution( *this, s, r );
  68.   }
  69.  
  70. #endif
  71.